package light.head.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;

/**
 * 供应信息
 */
@Entity
@Table
public class SupplyInfo implements Serializable{
	private static final long serialVersionUID = 1573546903946604334L;
	private Integer code;					// 流水号
	private Integer oc;						// 公司编号
	private String name;					// 公司名称
	private String title;					// 标题
	private String brand;					// 品牌
	private String norm;					// 规格
	private Integer num;					// 数量
	private String price;					// 价格
	private String content;					// 具体内容
	private Date bidTime;					// 中标时间
	private Date stopTime;					// 截止时间 
	private String address;					// 地址
	private Byte status = 1;				// 状态(1，投标中 ,2，已完结  )
	private Integer joinNum = 0;			// 参与人数
	private Integer browseNum = 0;			// 浏览次数
	private Integer cu;						// 创建人
	private Date ct;						// 创建时间
	private boolean deleted;				// 是否删除
	private List<SupplyAnnex> list;			// 封面图片附件
	private List<SupplyJoinInfo> sjlist;	// 参与投标的公司留言信息
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column
	public Date getBidTime() {
		return bidTime;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Column(length = 400)
	public String getTitle() {
		return title;
	}
	@Column(length = 200)
	public String getBrand() {
		return brand;
	}
	@Column(length = 200)
	public String getAddress() {
		return address;
	}
	@Column
	public String getNorm() {
		return norm;
	}
	@Column
	public Byte getStatus() {
		return status;
	}
	@Column
	public Integer getNum() {
		return num;
	}
	@Column
	public String getPrice() {
		return price;
	}
	@Column(length = 10000)
	public String getContent() {
		return content;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column
	public Date getStopTime() {
		return stopTime;
	}
	@Formula("(SELECT COUNT(*) FROM SupplyJoinInfo sji WHERE sji.sic = code)")
	public Integer getJoinNum() {
		return joinNum;
	}
	@Column
	public Integer getBrowseNum() {
		return browseNum;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	@Column
	public boolean getDeleted() {
		return deleted;
	}
	@Column
	public String getName() {
		return name;
	}
	@Transient
	public List<SupplyAnnex> getList() {
		return list;
	}
	@Transient
	public List<SupplyJoinInfo> getSjlist() {
		return sjlist;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setBidTime(Date bidTime) {
		this.bidTime = bidTime;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public void setBrand(String brand) {
		this.brand = brand;
	}
	public void setNorm(String norm) {
		this.norm = norm;
	}
	
	public void setAddress(String address) {
		this.address = address;
	}
	public void setNum(Integer num) {
		this.num = num;
	}
	public void setPrice(String price) {
		this.price = price;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public void setStatus(Byte status) {
		this.status = status;
	}
	public void setStopTime(Date stopTime) {
		this.stopTime = stopTime;
	}
	public void setJoinNum(Integer joinNum) {
		this.joinNum = joinNum;
	}
	public void setBrowseNum(Integer browseNum) {
		this.browseNum = browseNum;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setList(List<SupplyAnnex> list) {
		this.list = list;
	}
	public void setSjlist(List<SupplyJoinInfo> sjlist) {
		this.sjlist = sjlist;
	}
	
	
}
